import { request } from '../util/request';

interface VideoItem {
  id: number;
  title: string;
  cover: string;
  videoUrl: string;
  likes: number;
  comments: number;
  author: {
    id: number;
    username: string;
    avatar: string;
  };
}

export const getVideoFeed = (): Promise<VideoItem[]> => {
  return Promise.resolve(
    Array(10).fill(0).map((_, i) => ({
      id: i,
      title: `短视频标题 ${i + 1}`,
      cover: 'https://files.manuscdn.com/assets/video/Manus-Chinese-2k-compressed-v2.mp4',
      videoUrl: 'https://files.manuscdn.com/assets/video/Manus-Chinese-2k-compressed-v2.mp4',
      likes: Math.floor(Math.random() * 1000),
      comments: Math.floor(Math.random() * 500),
      author: {
        id: 1000 + i,
        username: '创作者' + (i + 1),
        avatar: 'https://img1.baidu.com/it/u=782038848,3912064776&fm=253&fmt=auto&app=120&f=JPEG?w=400&h=400'
      }
    }))
  );
};

export const getVideoDetail = (videoId: number): Promise<VideoItem> => {
  return Promise.resolve({
    id: videoId,
    title: '短视频详情标题',
    cover: 'https://miaoying.com/video/cover-detail.jpg',
    videoUrl: 'https://miaoying.com/video/stream.mp4',
    likes: 1234,
    comments: 567,
    author: {
      id: 999,
      username: '热门创作者',
      avatar: 'https://miaoying.com/avatar/popular.png'
    }
  });
};
